package com.oak.broke.model.vip.v1;

import com.oak.broke.model.vip.service.IVipOpenRecordService;
import com.oak.broke.model.vip.vo.api.VipOpenRecordVO;
import com.oak.broke.model.vip.base.PageUtil;
import com.oak.broke.model.vip.base.ResponseMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tanghan
 * @Description vip开通记录api
 * @date 2023/04/14/ 16:33:00
 */
@RestController
@RequestMapping("/api/v1/vip/open/record")
@Api(tags = "会员开通记录controller")
public class VipOpenRecordV1Api {

    @Autowired
    private IVipOpenRecordService vipOpenRecordService;

    /**
     * 查询会员开通记录
     *
     * @param userRelationCode 用户code
     * @param vipUserType      用户类型
     * @param pageNo           当前页
     * @param pageSize         每页大小
     * @return
     */
    @ApiOperation("查询会员开通记录")
    @GetMapping("/list")
    public ResponseMessage<PageUtil<VipOpenRecordVO>> list(@RequestParam String userRelationCode,
                                                           @RequestParam String vipUserType,
                                                           @RequestParam(defaultValue = "1") Integer pageNo,
                                                           @RequestParam(defaultValue = "5") Integer pageSize) {
        return ResponseMessage.success(vipOpenRecordService.listVipOpenRecord(userRelationCode, vipUserType, pageNo, pageSize));
    }
}
